// Decompiled by Jad v1.5.8e2. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://kpdus.tripod.com/jad.html
// Decompiler options: packimports(3)
// Source File Name: AdminSetTypesAction.java

package com.market.web.action;

import java.util.List;

import org.apache.struts.util.LabelValueBean;

import com.market.web.XMLLoader;

// Referenced classes of package com.market.web.action:
// BaseAction

public class AdminSetTypesAction extends BaseAction2
{

    public AdminSetTypesAction()
    {
    }

    private String category;
    private String value;
    public String execute() throws Exception
    {
        //DynaActionForm tf = (DynaActionForm)form;
        String category = getCategory();//tf.getString("category");
        String value = getValue();//tf.getString("value");
        if (category != null && value != null)
        {
            if ("beer".equals(category) || "rice".equals(category)|| "safety".equals(category))
                
                XMLLoader.setTypes(category, value);
           
            if ("units".equals(category))
                XMLLoader.setUnits(value);
        }
        StringBuffer rice = new StringBuffer();
        List lrice = XMLLoader.getRiceTypes();
        for (int i = 0; i < lrice.size(); i++)
        {
            LabelValueBean lvb = (LabelValueBean)lrice.get(i);
            rice.append(lvb.getValue()).append(",");
        }

        StringBuffer beer = new StringBuffer();
        List lbeer = XMLLoader.getBeerTypes();
        for (int i = 0; i < lbeer.size(); i++)
        {
            LabelValueBean lvb = (LabelValueBean)lbeer.get(i);
            beer.append(lvb.getValue()).append(",");
        }

        /*StringBuffer ball = new StringBuffer();
        List lball = XMLLoader.getBallTypes();
        for (int i = 0; i < lball.size(); i++)
        {
            LabelValueBean lvb = (LabelValueBean)lball.get(i);
            ball.append(lvb.getValue()).append(",");
        }

        StringBuffer coll = new StringBuffer();
        List lcoll = XMLLoader.getCollTypes();
        for (int i = 0; i < lcoll.size(); i++)
        {
            LabelValueBean lvb = (LabelValueBean)lcoll.get(i);
            coll.append(lvb.getValue()).append(",");
        }
*/
        StringBuffer safety = new StringBuffer();
        List lsafety = XMLLoader.getSafetyTypes();
        for (int i = 0; i < lsafety.size(); i++)
        {
            LabelValueBean lvb = (LabelValueBean)lsafety.get(i);
            safety.append(lvb.getValue()).append(",");
        }

      /*  StringBuffer arrow = new StringBuffer();
        List larrow = XMLLoader.getArrowTypes();
        for (int i = 0; i < larrow.size(); i++)
        {
            LabelValueBean lvb = (LabelValueBean)larrow.get(i);
            arrow.append(lvb.getValue()).append(",");
        }
*/
        StringBuffer units = new StringBuffer();
        List lunits = XMLLoader.getUnits();
        for (int i = 0; i < lunits.size(); i++)
        {
            LabelValueBean lvb = (LabelValueBean)lunits.get(i);
            units.append(lvb.getValue()).append(",");
        }

        getRequest().setAttribute("rice", rice.toString());
        getRequest().setAttribute("beer", beer.toString());
        //request.setAttribute("ball", ball.toString());
        getRequest().setAttribute("safety", safety.toString());
        //request.setAttribute("collimator", coll.toString());
        //request.setAttribute("arrow", arrow.toString());
        getRequest().setAttribute("units", units.toString());
        return SUCCESS;//mapping.findForward("types");
    }
    public String getCategory()
    {
        return category;
    }
    public void setCategory(String category)
    {
        this.category = category;
    }
    public String getValue()
    {
        return value;
    }
    public void setValue(String value)
    {
        this.value = value;
    }
}
